!function() {
    getApp();
    var e = require("../../../siteinfo.js");
    var h = require("../../../utils/http.js");
    Page({
        data: {
            id:0,
            openId:'',
            detail: "",
        },
        onLoad: function(e) {
            var _that = this;
            var id = e.id;
            _that.setData({
                id:id,
            });
            wx.login({
              success: function(e) {
                h.post("/app/exp/wxappLogin1", {
                    code: e.code,
                    uid: 0
                }, !1, function(o) {
                  console.log('o',o);
                  _that.setData({
                    openId:o.openid,
                  });
                });
              }
            }); 
          this.getOrderDetail(id);
		  },

		getOrderDetail: function() {
      var token = wx.getStorageSync("userToken");
      var _that = this;
      var id = _that.data.id;
      var openId = _that.data.openId;
			wx.request({
        url: e.siteroot + "/app/exp/detail",
        method: "POST",
        header: {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        data: {
          openId: openId,
          recipients_id: id,
        },
        success: function(e) {
          console.log("o", e), 1 == e.data.code ? _that.setData({
            detail:e.data.data,
          }) : wx.showModal({
            title: "提示",
            content: e.data.msg
          });
        }
      });
		},
   
    getPay(t) {
        var _that = this;
        var id = _that.data.id;
        var openId = _that.data.openId;
        h.post("/app/Dock/behalfPay", {
            id: id,
            openId: openId
        }, !1, function(e) {
            e && wx.requestPayment({
                nonceStr: e.nonceStr,
                package: e.package,
                paySign: e.paySign,
                timeStamp: e.timeStamp,
                signType: e.signType,
                success: e => {
                    wx.showToast({
                        title: "支付成功"
                    }), wx.switchTab({
                        url: "/pages/member/index/index"
                    });
                },
                fail: e => {
                    console.log("fail:" + JSON.stringify(e));
                }
            });
        });
      },
      onReady: function() {},
      onShow: function() {},
      onHide: function() {},
      onUnload: function() {},
      onPullDownRefresh: function() {},
      onReachBottom: function() {},
      onShareAppMessage: function() {}
    });
}();